<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            padding:0;
            margin:0;
        }
        #app {
            width: 400px;
            height: 400px;
            border:1px solid green;
            margin:20px auto;
            font-size: 0;
        }
    </style>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    const app = document.querySelector("#app");
    const col = 2;// 初始的列表
    const xzIndex = getRandom(0,col*col-1);// 徐峥所在的下标
    for(let i=0;i<col*col;i++){
        const img = new Image();
        img.width=img.height=app.clientWidth/col;
        img.src = i===xzIndex?"./img/1.png":"./img/2.png";
        app.appendChild(img);
    }
    function getRandom(min,max){
        return Math.floor(Math.random()*(max-min+1)+min);
    }
</script>
</html>